package qiutan

func main()  {
	/**
	sql:="insert into qt_match values "
	i:=0
	j:=0
	boltdb.ScanTx("matchs", func(tx *bolt.Tx) {

		tx.ForEach(func(name []byte, b *bolt.Bucket) error {
			b.ForEach(func(k, v []byte) error {
				content := string(v)
				s := strings.Split(content, "^")

				if len(s)<8||strings.TrimSpace(s[7])==""{
					return nil
				}
				league:=s[1]
				startAt:=s[2]
				t1:=s[3]
				t2:=s[5]
				reg, _ := regexp.Compile("\\[[\\S\\s]+?]")
				reg2, _ := regexp.Compile("\\([\\S\\s]+?\\)")
				//主队
				t1= reg.ReplaceAllString(t1, "")
				t1=reg2.ReplaceAllString(t1,"")
				t1=strings.TrimSpace(t1)
				//客队
				t2= reg.ReplaceAllString(t2, "")
				t2=reg2.ReplaceAllString(t2,"")
				t2=strings.TrimSpace(t2)
				s1:=s[4]
				s2:=s[6]
				if i==999{
					sql+="("+s[0]+",'"+league+"','"+startAt+"','"+t1+"','"+t2+"',"+s1+","+s2+")"
					mysql.Insert(sql)
					sql="insert into qt_match values "
					j++
					i=0
					fmt.Println(j)
				}else{
					sql+="("+s[0]+",'"+league+"','"+startAt+"','"+t1+"','"+t2+"',"+s1+","+s2+"),"
				}
				i++

				return nil
			})
			return nil
		})
	})
	sql=strings.TrimRight(sql,",")

	mysql.Insert(sql)
	fmt.Println(i)**/
}
